using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using Fan.Dongping.DataAccess;
using Fan.Dongping.Common.Bean;
using Fan.Dongping.Common.DBMeta;

//namespace check;
public partial class _CreateImg : PageBase
{
    public string worflowNo, docNo, language;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack == false)
        {
            worflowNo = Request.Params["W"];
            docNo = Request.Params["D"];
            language = Request.Params["L"];
        }

        this.CreateImage();
    }

    private void CreateImage()
    {
        DocumentData wg = DocumentData.CreateDocument(worflowNo, docNo);
        //Session.Add(worflowNo + docNo, wg);

        //fillData(wg);

        bool isEnglish = false;

        switch (Language)
        {
            case Fan.Dongping.Common.Languages.en_US:
                isEnglish = true;
                break;
            case Fan.Dongping.Common.Languages.zh_CH:
                break;
            default:
                break;
        }


        Bitmap img = wg.Drawing(isEnglish);
        MemoryStream ms = new MemoryStream();
        img.Save(ms, ImageFormat.Png);
        //Response.ClearContent();
        Response.ContentType = "image/png";
        Response.BinaryWrite(ms.ToArray());
        Response.End();
    }

}
